package io.demo01;

import java.io.File;
import java.util.Arrays;

/**
 * @author cyt
 * @create 2020-02-23 13:20
 */
public class FileDemo {
    public static void main(String[] args) {
        File file = new File("F:write.txt");

        System.out.println(file.exists() ? "存在" : "不存在");
        System.out.println(file.isFile() ? "是文件" : "不是文件");
        System.out.println(file.isDirectory() ? "是文件夹" : "不是文件夹");
        System.out.println(file.getPath());
        System.out.println(file.getAbsolutePath());
        System.out.println(file.getName());
        System.out.println(file.length());
        File file1 = new File("C:\\Users\\win10\\Desktop");
        File[] files = file1.listFiles();
        Arrays.asList(files).forEach(a -> {
            System.out.println("" + a.getName());
        });
    }
}
